package org.chen.pool;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

public class JedisPoolTest2 {
  /**
   *try(){} 这个方法要把语言级别调到8（language level 8）以上
   * 且也要把项目的java compiler的model bytecode version设置为8
   */
  public static void main(String[] args) {
    //创建连接池
    JedisPool jedisPool = new JedisPool("192.168.33.113");
    //从连接池中获取jedis
    try (Jedis jedis =jedisPool.getResource()){
      //测试连接
      System.out.println(jedis.ping());

      //jedis操作

    }
  }
}
